package com.yiyahui.project.erp.service.impl;

import java.util.List;
import com.yiyahui.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiyahui.project.erp.mapper.YiyaScoreGoodsMapper;
import com.yiyahui.project.erp.domain.YiyaScoreGoods;
import com.yiyahui.project.erp.service.IYiyaScoreGoodsService;

/**
 * 积分商品Service业务层处理
 * 
 * @author yiyahui
 * @date 2020-05-12
 */
@Service
public class YiyaScoreGoodsServiceImpl implements IYiyaScoreGoodsService 
{
    @Autowired
    private YiyaScoreGoodsMapper yiyaScoreGoodsMapper;

    /**
     * 查询积分商品
     * 
     * @param id 积分商品ID
     * @return 积分商品
     */
    @Override
    public YiyaScoreGoods selectYiyaScoreGoodsById(Long id)
    {
        return yiyaScoreGoodsMapper.selectYiyaScoreGoodsById(id);
    }

    /**
     * 查询积分商品列表
     * 
     * @param yiyaScoreGoods 积分商品
     * @return 积分商品
     */
    @Override
    public List<YiyaScoreGoods> selectYiyaScoreGoodsList(YiyaScoreGoods yiyaScoreGoods)
    {
        return yiyaScoreGoodsMapper.selectYiyaScoreGoodsList(yiyaScoreGoods);
    }

    /**
     * 新增积分商品
     * 
     * @param yiyaScoreGoods 积分商品
     * @return 结果
     */
    @Override
    public int insertYiyaScoreGoods(YiyaScoreGoods yiyaScoreGoods)
    {
        yiyaScoreGoods.setCreateTime(DateUtils.getNowDate());
        return yiyaScoreGoodsMapper.insertYiyaScoreGoods(yiyaScoreGoods);
    }

    /**
     * 修改积分商品
     * 
     * @param yiyaScoreGoods 积分商品
     * @return 结果
     */
    @Override
    public int updateYiyaScoreGoods(YiyaScoreGoods yiyaScoreGoods)
    {
        yiyaScoreGoods.setUpdateTime(DateUtils.getNowDate());
        return yiyaScoreGoodsMapper.updateYiyaScoreGoods(yiyaScoreGoods);
    }

    /**
     * 批量删除积分商品
     * 
     * @param ids 需要删除的积分商品ID
     * @return 结果
     */
    @Override
    public int deleteYiyaScoreGoodsByIds(Long[] ids)
    {
        return yiyaScoreGoodsMapper.deleteYiyaScoreGoodsByIds(ids);
    }

    /**
     * 删除积分商品信息
     * 
     * @param id 积分商品ID
     * @return 结果
     */
    @Override
    public int deleteYiyaScoreGoodsById(Long id)
    {
        return yiyaScoreGoodsMapper.deleteYiyaScoreGoodsById(id);
    }
}
